<template>
  <img :src="imgSrcComputed" class="avatar" alt="用户头像" />
</template>

<script>
let defaultImg = require('/src/common/img/default_icon.svg')

export default {
  props: {
    imgSrc: {
      type: String,
      default: ''
    }
  },

  computed: {
    imgSrcComputed() {
      return this.imgSrc || defaultImg
    }
  }
}
</script>

<style>
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 15px;
  border: 1px solid #ddd;
}
</style>